//: [Previous](@previous)

import Foundation

var greeting = "Hello, playground"

//: [Next](@next)

let age = 10
//age = 20

let dog1:String;
var dog2:String;
//print(dog1,dog2)//dog1、dog2未初始化赋值，直接报错，无法使用



let d : Float  = 12.0
let t = 30.0

//布尔：OC中是YES与NO
let bool = true//取反是false
//字符串
let str = "潮汐"
//字符
let chat = "🐱"
//整数
let intDec = 17
//浮点数
let doubleDec = 125.0
//数组
let array = [1, 2, 3, 4]
//字典
let dict = ["age": 18, "height": 100]



//整数转化
let int1:UInt16 = 2_000
let int2:UInt8 = 1
let int3  = int1 + UInt16(int2)

//整数、浮点数转换
let int = 3
let double = 0.1344
let pi = Double(int) + double
let intPi = Int(pi)

//字面量可以直接相加，因为数字字面量本身没有明确类型
let result = 3 + 12.5366


//元组
let http404Error = (404, "Not Fount")
//类似枚举、数组取值
print(http404Error.0, http404Error.1)//打印：404 Not Fount
//赋值给另一个元组
let (code, message) = http404Error
//_表示忽略后面那个值，不会赋值给它
let (codeState, _) = http404Error
//访问
let https200Status = (codeSucess: 200, description: "OK")
print("ther state code is \(https200Status.codeSucess)")//打印：ther state code is 200


